Ext.onReady(function(){
	
	var types = new Ext.data.SimpleStore({
		fields:['type'],
		data:[['Provider'],['Rider']]
	});
	
	var simple = new Ext.FormPanel({
        labelWidth: 75, // label settings here cascade unless overridden
        url:'save-form.php',
        frame:true,
        title: 'Create Carpool',
        bodyStyle:'padding:5px 5px 0',
        width: 350,
        defaults: {width:230},
        defaultType: 'textfield',
        monitorValid:true,
        items: [/*{
                xtype: 'combo',
                name: 'serviceType',
                fieldLabel:'Service Type',
                mode:'local',
                store: types ,
                displayField:'type',
                allowBlank:false,
                width: 80
            },*/
                {
                	xtype: 'displayfield',
                	fieldLabel: 'Service Type',
                	value: 'Provider'
                },{
                fieldLabel: 'Car Name',
                name: 'carName',
                allowBlank:false
                //width: 80
            },{
            	xtype: 'textfield',
                fieldLabel: 'NO of Seats Availble',
                name: 'noSeats',
                allowBlank:false,
                length:2,
                width: 40
            },{
                fieldLabel: 'Originating Point',
                name: 'source',
                allowBlank:false,
                width: 80
            },{
                fieldLabel: 'Destination Point',
                name: 'destination',
                allowBlank:false,
                width: 80
            },{
                fieldLabel: 'Route',
                name: 'Route',
                allowBlank:false
               // width: 120
            },{
                xtype:'button',
                text: 'Add Route',
                width:100,
                handler: function() {
                    var p = simple.items.length - 4;
                    //alert("Hi ra"+p);
                    simple.insert(p, {
                        xtype: 'textfield'
                       //fieldLabel: 'Added field' 
                    });
                    simple.doLayout();
                }
            }, {
                xtype: 'timefield',
                fieldLabel: 'Start Time',
                name: 'startTime',
                allowBlank:false,
                width: 80
            }, {
                xtype: 'timefield',
                fieldLabel: 'Return Time',
                name: 'returnTime',
                allowBlank:false,
                width: 80
            },{
                xtype: 'textarea',
                fieldLabel: 'Description',
                name: 'description',
                allowBlank:false
                //width: 80
            }
            
        ],

        buttons: [{
            text: 'Save',
            formBind: true	
        }]
    });

    simple.render("createCarPool");
});		